# Mobroute Commandline Interface

For developers, testers, and users who are familiar with
commandline, Mobroute CLI offers a direct way to use Mobroute's
API without installing a graphical application (such as
[Transito](https://git.sr.ht/~mil/transito)) or setting and and
using Mobroute's Go library. The CLI of Mobroute is the fastest way to
get started with Mobroute as such and a first-class citizen for testing
purposes.

The CLI operates by using several subcommands:

```sh
mobroute [subcommand]
```

Each subcommand supports different addtional flags:

## **route**

```sh
Usage of route:
  -d string
        Verbose debug categories: (i) Information (w) Warn (d) Debug (default "i")
  -dprof string
        Write debug pprof CPU profile to file
  -format string
        Output format, currently only json supported (default "json")
  -p string
        YAML Parameters for db subcommand; note JSON is also valid YAML as well

        Valid properties:
          - filter: Object based on mobsql's filter specification, see git.sr.ht/~mil/mobsql (default: {mdbid: [516]})
          - from: Object with two float properties, lat & lon (default: {lat: 40.70940, lon: -74.00537})
          - to: Object with two float properties, lat & lon (default: {lat: 40.72879, lon: -73.95215})
          - time: Datetime to depart from trip, if unset defaults to current time / now (default: null)
          - max_walk_seconds: Maximum seconds walking distance on start/end of trip to get to/from origin/destination stops (default: 600)
          - max_trip_seconds: Maximum seconds the entire route/trip can take (default: 14400)
          - min_transfer_seconds: Minimum seconds each transfer in the route can take (default: 180)
          - max_transfer_seconds: Maximum seconds each transfer in the route can take (default: 1200)
          - walkspeed_km_hr: Ratio of kilometers per hour the user walk (default: 4.5)
          - transfers_table: Whether to use source GTFS transfers.txt (default: true)
          - transfers_generated: Whether to generate transfers, infered if >1 source (default: false)
          - debug_formatting: Whether to output verbose debug route formatting (default: false)
                 (default "{filter: {mdbid: [516]}, from: {lat: 40.70940, lon: -74.00537}, to: {lat: 40.72879, lon: -73.95215}}")

```

## **dbload**

Load from database. Same as [Mobsql's load
command](https://git.sr.ht/~mil/mobsql#strongcommandline-documentationstrong).
Pass -f to change filter based on [Mobsql](http://git.sr.ht/~mil/mobsql).

## **dbcompute**

Compute from database. Same as [Mobsql's compute
command](https://git.sr.ht/~mil/mobsql#strongcommandline-documentationstrong).
Pass -f to change filter based on [Mobsql](http://git.sr.ht/~mil/mobsql).

## **dbstatus**

Status from database. Same as [Mobsql's status
command](https://git.sr.ht/~mil/mobsql#strongcommandline-documentationstrong).
Pass -f to change filter based on [Mobsql](http://git.sr.ht/~mil/mobsql).

## *Note on removed commands*

*Note: earlier versions of Mobroute such as 0.1 supported commands such as
stoptimes and stops; this functionality was temporarily dropped with a largescale
rework to the codebase's dataload functionality. In the future the stops and
stoptimes commands will be added back to enable users to see nearby stops
and departure times for nearby stops.*

